/** * Fixes text using Microsoft Latin-1 "Extentions", namely ASCII characters 128-160. * * @param text Text to be modified. (Required) * @return Returns a string. * @author Shawn Porter (sporter@rit.net) * @version 1, June 16, 2004 */ function DeMoronize (text) { var i = 0; /* VERY useful for fixing word for (i = 140; i LTE 999; i = i + 1) text = Replace(text, Chr(i), i, "All"); */ // map incompatible non-ISO characters into plausible // substitutes //cant do it here cuz it looks funny when you re-edit a story //text = Replace(text, Chr(10), "
", "All"); text = Replace(text, Chr(128), "", "All"); text = Replace(text, Chr(130), ",", "All"); text = Replace(text, Chr(131), "f", "All"); text = Replace(text, Chr(132), ",,", "All"); text = Replace(text, Chr(133), "...", "All"); text = Replace(text, Chr(136), "^", "All"); text = Replace(text, Chr(139), ")", "All"); text = Replace(text, Chr(140), "", "All"); text = Replace(text, Chr(145), "`", "All"); text = Replace(text, Chr(146), "'", "All"); text = Replace(text, Chr(147), "-", "All"); text = Replace(text, Chr(148), """", "All"); text = Replace(text, Chr(149), "*", "All"); text = Replace(text, Chr(150), "-", "All"); text = Replace(text, Chr(151), "--", "All"); text = Replace(text, Chr(152), "'", "All"); text = Replace(text, Chr(153), "'", "All"); text = Replace(text, Chr(155), ")", "All"); text = Replace(text, Chr(156), """", "All"); text = Replace(text, Chr(157), """", "All"); // remove any remaining ASCII 128-159 characters for (i = 128; i LTE 159; i = i + 1) text = Replace(text, Chr(i), "", "All"); // map Latin-1 supplemental characters into // their &name; encoded substitutes text = Replace(text, Chr(160), " ", "All"); text = Replace(text, Chr(163), "£", "All"); text = Replace(text, Chr(169), "©", "All"); text = Replace(text, Chr(176), "°", "All"); // encode ASCII 160-255 using ϧ format for (i = 160; i LTE 255; i = i + 1) text = REReplace(text, "(#Chr(i)#)", "", "All"); // supply missing semicolon at end of numeric entities text = ReReplace(text, "&##([0-2][[:digit:]]{2})([^;])", "", "All"); // fix obscure numeric rendering of < > & text = ReReplace(text, "&##038;", "&", "All"); text = ReReplace(text, "&##060;", "<", "All"); text = ReReplace(text, "&##062;", ">", "All"); // supply missing semicolon at the end of & " text = ReReplace(text, "&(^;)", "&\1", "All"); text = ReReplace(text, ""(^;)", ""\1", "All"); /* */ return text; } /* ORIGINAL function DeMoronize (text) { var i = 0; // map incompatible non-ISO characters into plausible // substitutes text = Replace(text, Chr(128), "€", "All"); text = Replace(text, Chr(130), ",", "All"); text = Replace(text, Chr(131), "f", "All"); text = Replace(text, Chr(132), ",,", "All"); text = Replace(text, Chr(133), "...", "All"); text = Replace(text, Chr(136), "^", "All"); text = Replace(text, Chr(139), ")", "All"); text = Replace(text, Chr(140), "Oe", "All"); text = Replace(text, Chr(145), "`", "All"); text = Replace(text, Chr(146), "'", "All"); text = Replace(text, Chr(147), """", "All"); text = Replace(text, Chr(148), """", "All"); text = Replace(text, Chr(149), "*", "All"); text = Replace(text, Chr(150), "-", "All"); text = Replace(text, Chr(151), "--", "All"); text = Replace(text, Chr(152), "~", "All"); text = Replace(text, Chr(153), "™", "All"); text = Replace(text, Chr(155), ")", "All"); text = Replace(text, Chr(156), "oe", "All"); // remove any remaining ASCII 128-159 characters for (i = 128; i LTE 159; i = i + 1) text = Replace(text, Chr(i), "", "All"); // map Latin-1 supplemental characters into // their &name; encoded substitutes text = Replace(text, Chr(160), " ", "All"); text = Replace(text, Chr(163), "£", "All"); text = Replace(text, Chr(169), "©", "All"); text = Replace(text, Chr(176), "°", "All"); // encode ASCII 160-255 using ϧ format for (i = 160; i LTE 255; i = i + 1) text = REReplace(text, "(#Chr(i)#)", "&###i#;", "All"); // supply missing semicolon at end of numeric entities text = ReReplace(text, "&##([0-2][[:digit:]]{2})([^;])", "&##\1;\2", "All"); // fix obscure numeric rendering of < > & text = ReReplace(text, "&##038;", "&", "All"); text = ReReplace(text, "&##060;", "<", "All"); text = ReReplace(text, "&##062;", ">", "All"); // supply missing semicolon at the end of & " text = ReReplace(text, "&(^;)", "&\1", "All"); text = ReReplace(text, ""(^;)", ""\1", "All"); return text; } */